/**
 * Desc
 * @description Holp You Do Good But Not Evil
 * @copyright   Copyright 2014-2015 <ycchen@iwshop.cn>
 * @license     LGPL (http=>//www.gnu.org/licenses/lgpl.html)
 * @author      Chenyong Cai <ycchen@iwshop.cn>
 * @package     Wshop
 * @link        http=>//www.iwshop.cn
 */
requirejs(['jquery', 'util', 'highcharts','fancyBox', 'datatables', 'Spinner','layer','laytpl','laypage','WdatePicker','datetimepicker','xdate'], function($, util, highcharts,fancyBox, dataTables, Spinner,layer,laytpl,laypage,WdatePicker,xdate) {
    $(function() {
    	
    	
    	
        $.get(shoproot + '?/WdminStat/getIncome/', function(res) {
            $('.stat-h-50').eq(0).highcharts({
                credits: {
                    enabled: false
                },
                title: {
                    text: '每日收入趋势图',
                    style: {
                        fontSize: '15px',
                        color: '#666',
                        fontWeight: 'lighter'
                    }
                },
                chart: {
                    type: 'line',
                    style: {
                        fontFamily: '"Microsoft YaHei"',
                        fontSize: '12px'
                    }
                },
                xAxis: {
                    categories: res.x,
                    lineWidth: 0
                },
                yAxis: {
                    title: {
                        text: ''
                    },
                    minPadding: 0
                },
                legend: {
                    enabled: false
                },
                plotOptions: {
                    line: {
                        dataLabels: {
                            enabled: true,
                            x: 0,
                            y: -7,
                            style: {
                                fontFamily: '"Microsoft YaHei"'
                            },
                            format: '{y}元'
                        }
                    }
                },
                exporting: {
                    enabled: false
                },
                series: [{
                        name: '收入',
                        data: res.y
                    }]
            });
        });
       

        $.get(shoproot + '?/WdminStat/getFinStat/', function(res) {
            $('.stat2-h-50').eq(0).highcharts({
                credits: {
                    enabled: false
                },
                title: {
                    text: '月份盈亏趋势图',
                    style: {
                        fontSize: '15px',
                        color: '#666',
                        fontWeight: 'lighter'
                    }
                },
                chart: {
                    type: 'line',
                    style: {
                        fontFamily: '"Microsoft YaHei"',
                        fontSize: '12px'
                    }
                },
                xAxis: {
                    categories: res.x,
                    lineWidth: 0
                },
                yAxis: {
                    title: {
                        text: ''
                    },
                    minPadding: 0
                },
                legend: {
                    enabled: false
                },
                plotOptions: {
                    line: {
                        dataLabels: {
                            enabled: true,
                            x: 0,
                            y: -7,
                            style: {
                                fontFamily: '"Microsoft YaHei"'
                            },
                            format: '{y}元'
                        }
                    }
                },
                exporting: {
                    enabled: false
                },
                series: [{
                        name: '盈余',
                        data: res.y
                    }]
            });
        });
        util.onresize(function() {
            var h = $(window).height() - 2;
            $('.stat-h-50').height(h / 2);
            $('.stat2-h-50').height(h / 2);
            $('#stat-wrap').height(h);
        });
    });
});